package com.zl.androidframework

import android.graphics.Color
import android.os.Bundle
import android.widget.Button
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.FragmentContainerView
import com.tencent.bugly.crashreport.CrashReport
import com.zl.androidframework.databinding.ActivityMainBinding
import com.zl.lib_base.base.BaseActivity
import com.zl.lib_base.utils.AppUtil
import com.zl.lib_base.widget.CommonBottomNavigationBar


class MainActivity : BaseActivity<ActivityMainBinding>(ActivityMainBinding::inflate){

    lateinit var tabBottom: CommonBottomNavigationBar
    lateinit var mainFragment: FragmentContainerView

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        tabBottom = viewBinding.tabBottom
        mainFragment = viewBinding.mainFragment

        initBottomTab()

    }

    private fun initBottomTab() {
        tabBottom.setMenu(R.menu.tab_bottom_menu)
        tabBottom.setFragmentManager(supportFragmentManager, mainFragment)
        tabBottom.isReplace = false
        tabBottom.addFragment(R.id.tab1, HomeFragment())
        tabBottom.addFragment(R.id.tab2, TeacFragment())
        tabBottom.addFragment(R.id.tab3, WorkFragment())
        tabBottom.addFragment(R.id.tab4, ClassFragment())
        tabBottom.addFragment(R.id.tab5, MineFragment())
        tabBottom.setFloatingEnable(true)
        tabBottom.setTopLineColor(Color.RED)
        tabBottom.setItemColorStateList(R.drawable.item_check)
        tabBottom.setMsgCount(0, 32)
        tabBottom.setMsgCount(2, 1)
        tabBottom.setMsgCount(1, -1)
        tabBottom.setOnItemSelectedListener { item, position ->
//            if (position == 1) {
//                oneBottomLayout.setFloatingEnable(true)
//            } else {
//                oneBottomLayout.setFloatingEnable(false)
//            }
            false
        }

    }
}